home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1996 #14 / Monster Media No. 14 (April 1996) (Monster Media, Inc.).ISO / prog_bas / easynet.zip / DEMO.ZIP / NETWORK.FRM < prev    next >
Text File  |  1996-01-01  |  10KB  |  407 lines

  1. VERSION 4.00
  2. Begin VB.Form Form2 
  3.    Appearance      =   0  'Flat
  4.    BackColor       =   &H80000005&
  5.    Caption         =   "Example 2: NetWork"
  6.    ClientHeight    =   4545
  7.    ClientLeft      =   1095
  8.    ClientTop       =   1830
  9.    ClientWidth     =   6270
  10.    BeginProperty Font 
  11.       name            =   "MS Sans Serif"
  12.       charset         =   1
  13.       weight          =   700
  14.       size            =   8.25
  15.       underline       =   0   'False
  16.       italic          =   0   'False
  17.       strikethrough   =   0   'False
  18.    EndProperty
  19.    ForeColor       =   &H80000008&
  20.    Height          =   4950
  21.    Left            =   1035
  22.    LinkTopic       =   "Form2"
  23.    MDIChild        =   -1  'True
  24.    ScaleHeight     =   4545
  25.    ScaleWidth      =   6270
  26.    Tag             =   "2"
  27.    Top             =   1485
  28.    Width           =   6390
  29.    Begin VB.PictureBox Picture1 
  30.       Appearance      =   0  'Flat
  31.       BackColor       =   &H80000005&
  32.       ForeColor       =   &H80000008&
  33.       Height          =   525
  34.       Index           =   2
  35.       Left            =   4110
  36.       Picture         =   "NETWORK.frx":0000
  37.       ScaleHeight     =   495
  38.       ScaleWidth      =   555
  39.       TabIndex        =   3
  40.       Top             =   3540
  41.       Visible         =   0   'False
  42.       Width           =   585
  43.    End
  44.    Begin VB.PictureBox Picture1 
  45.       Appearance      =   0  'Flat
  46.       BackColor       =   &H80000005&
  47.       ForeColor       =   &H80000008&
  48.       Height          =   525
  49.       Index           =   1
  50.       Left            =   3510
  51.       Picture         =   "NETWORK.frx":030A
  52.       ScaleHeight     =   495
  53.       ScaleWidth      =   555
  54.       TabIndex        =   2
  55.       Top             =   3540
  56.       Visible         =   0   'False
  57.       Width           =   585
  58.    End
  59.    Begin VB.PictureBox Picture1 
  60.       Appearance      =   0  'Flat
  61.       BackColor       =   &H80000005&
  62.       ForeColor       =   &H80000008&
  63.       Height          =   525
  64.       Index           =   0
  65.       Left            =   2910
  66.       Picture         =   "NETWORK.frx":0614
  67.       ScaleHeight     =   495
  68.       ScaleWidth      =   540
  69.       TabIndex        =   1
  70.       Top             =   3540
  71.       Visible         =   0   'False
  72.       Width           =   570
  73.    End
  74.    Begin VBX.EasyNet Net1 
  75.       Alignment       =   7  'Center - MIDDLE
  76.       AutoScroll      =   -1  'True
  77.       BackColor       =   &H00C0FFC0&
  78.       CanMultiLink    =   -1  'True
  79.       DrawColor       =   &H00FF0000&
  80.       DrawStyle       =   6  'Inside Solid
  81.       DrawWidth       =   1
  82.       FillColor       =   &H00F8FCF8&
  83.       FontBold        =   0   'False
  84.       FontItalic      =   0   'False
  85.       FontName        =   "MS Sans Serif"
  86.       FontSize        =   8.25
  87.       FontStrikethru  =   0   'False
  88.       FontUnderline   =   0   'False
  89.       ForeColor       =   &H00000000&
  90.       Height          =   3375
  91.       Hiding          =   0   'False
  92.       ImageFile       =   ""
  93.       Left            =   810
  94.       License         =   "NETWORK.frx":091E
  95.       MultiSel        =   -1  'True
  96.       ScrollBars      =   3  'Both
  97.       TabIndex        =   0
  98.       Top             =   90
  99.       Version         =   183
  100.       Width           =   5325
  101.       xGrid           =   75
  102.       yGrid           =   75
  103.       Begin VB.CommandButton Command5 
  104.          Appearance      =   0  'Flat
  105.          BackColor       =   &H80000005&
  106.          Caption         =   "&Next Stub"
  107.          BeginProperty Font 
  108.             name            =   "MS Sans Serif"
  109.             charset         =   1
  110.             weight          =   400
  111.             size            =   8.25
  112.             underline       =   0   'False
  113.             italic          =   0   'False
  114.             strikethrough   =   0   'False
  115.          EndProperty
  116.          Height          =   315
  117.          Left            =   2100
  118.          TabIndex        =   4
  119.          Top             =   2640
  120.          Width           =   855
  121.       End
  122.    End
  123. End
  124. Attribute VB_Name = "Form2"
  125. Attribute VB_Creatable = False
  126. Attribute VB_Exposed = False
  127. Option Explicit
  128.  
  129. Private Sub banner2()
  130.   Dim id&, id1&, id2&, id3&, id4&
  131.  
  132.   ' No oriented links
  133.   Net1.Oriented = False
  134.  
  135.   ' Nodes are rectangular transparent shapes
  136.   Net1.Shape = 1
  137.   Net1.Transparent = True
  138.  
  139.   Net1.EditAction = 0
  140.   Net1.Type = 1
  141.   Net1.X1 = 515
  142.   Net1.Y1 = 1700
  143.   Net1.X2 = 3600
  144.   Net1.Y2 = 1785
  145.   Net1.DrawStyle = 0
  146.   id = Net1.Item
  147.  
  148.   Net1.Item = 0
  149.   Net1.FillColor = RGB(0, 0, 0)
  150.  
  151.   Net1.EditAction = 0
  152.   Net1.Type = 2
  153.   Net1.X1 = 550
  154.   Net1.Y1 = 1725
  155.   Net1.X2 = 600
  156.   Net1.Y2 = 1775
  157.   id1 = Net1.Item
  158.   Net1.Owner = id
  159.  
  160.   Net1.EditAction = 0
  161.   Net1.Type = 2
  162.   Net1.X1 = 1525
  163.   Net1.Y1 = 1725
  164.   Net1.X2 = 1575
  165.   Net1.Y2 = 1775
  166.   id2 = Net1.Item
  167.   Net1.Owner = id
  168.  
  169.   Net1.EditAction = 0
  170.   Net1.Type = 2
  171.   Net1.X1 = 2450
  172.   Net1.Y1 = 1725
  173.   Net1.X2 = 2500
  174.   Net1.Y2 = 1775
  175.   id3 = Net1.Item
  176.   Net1.Owner = id
  177.  
  178.   Net1.EditAction = 0
  179.   Net1.Type = 2
  180.   Net1.X1 = 3450
  181.   Net1.Y1 = 1725
  182.   Net1.X2 = 3500
  183.   Net1.Y2 = 1775
  184.   id4 = Net1.Item
  185.   Net1.Owner = id
  186.  
  187.   Net1.Item = id
  188.   Net1.Data = id1
  189.  
  190.   Net1.Item = id1
  191.   Net1.Data = id2
  192.   Net1.Sleeping = True
  193.  
  194.   Net1.Item = id2
  195.   Net1.Data = id3
  196.   Net1.Sleeping = True
  197.  
  198.   Net1.Item = id3
  199.   Net1.Data = id4
  200.   Net1.Sleeping = True
  201.  
  202.   Net1.Item = id4
  203.   Net1.Data = id1
  204.   Net1.Sleeping = True
  205.  
  206.   Net1.Item = 0
  207.   Net1.Transparent = True
  208.   Net1.Picture = Picture1(0).Picture
  209.  
  210.   ' First node
  211.   Net1.EditAction = 0
  212.   Net1.X1 = 275
  213.   Net1.Y1 = 400
  214.   Net1.X2 = 875
  215.   Net1.Y2 = 1100
  216.   Net1.Text = "Paul"
  217.   Net1.Picture = Picture1(1).Picture
  218.   Net1.Org = Net1.Item
  219.   Net1.Dst = id1
  220.   Net1.EditAction = 1
  221.   Net1.DrawColor = RGB(255, 0, 0)
  222.   
  223.   ' Second node
  224.   Net1.EditAction = 0
  225.   Net1.X1 = 1200
  226.   Net1.Y1 = 200
  227.   Net1.X2 = 1900
  228.   Net1.Y2 = 900
  229.   Net1.Text = "Team 2"
  230.   Net1.Picture = Picture1(2).Picture
  231.   Net1.Org = Net1.Item
  232.   Net1.Dst = id2
  233.   Net1.EditAction = 1
  234.   Net1.DrawColor = RGB(255, 0, 0)
  235.  
  236.   ' Third node
  237.   Net1.EditAction = 0
  238.   Net1.X1 = 2175
  239.   Net1.Y1 = 400
  240.   Net1.X2 = 2775
  241.   Net1.Y2 = 1100
  242.   Net1.Text = "Lisa"
  243.   Net1.Picture = Picture1(1).Picture
  244.   Net1.Org = Net1.Item
  245.   Net1.Dst = id3
  246.   Net1.EditAction = 1
  247.   Net1.DrawColor = RGB(255, 0, 0)
  248.  
  249.   ' Fourth node
  250.   Net1.EditAction = 0
  251.   Net1.X1 = 3125
  252.   Net1.Y1 = 400
  253.   Net1.X2 = 3825
  254.   Net1.Y2 = 1100
  255.   Net1.Text = "George"
  256.   Net1.Picture = Picture1(1).Picture
  257.   Net1.Org = Net1.Item
  258.   Net1.Dst = id4
  259.   Net1.EditAction = 1
  260.   Net1.DrawColor = RGB(255, 0, 0)
  261.   
  262.   Net1.Item = 0
  263. End Sub
  264.  
  265. Private Sub Command5_Click()
  266.   Dim Org&, Dst&
  267.  
  268.   Org = Net1.Org
  269.   Dst = Net1.Dst
  270.   Net1.EditAction = 2
  271.  
  272.   Net1.Item = Dst
  273.   Net1.Dst = Net1.Data
  274.   Net1.Org = Org
  275.  
  276.   Net1.EditAction = 1
  277.   Net1.DrawColor = RGB(255, 0, 0)
  278.   Command5.Enabled = True
  279. End Sub
  280.  
  281. Private Sub Form_Activate()
  282.   ActivateForm
  283. End Sub
  284.  
  285. Private Sub Form_Deactivate()
  286.   DeactivateForm
  287. End Sub
  288.  
  289. Private Sub Form_Load()
  290.   MDI1.ShowExample(1).Enabled = False
  291.   MDI1.Command5.Enabled = False
  292.  
  293.   SpeedON Net1
  294.   banner2
  295.   SpeedOFF Net1
  296. End Sub
  297.  
  298. Private Sub Form_Resize()
  299.   If WindowState <> 1 And ScaleHeight <> 0 Then
  300.     Net1.Visible = False
  301.     Net1.Top = 0
  302.     Net1.Left = 0
  303.     Net1.Height = ScaleHeight
  304.     Net1.Width = ScaleWidth
  305.     Net1.Visible = True
  306.   End If
  307. End Sub
  308.  
  309. Private Sub Form_Unload(Cancel As Integer)
  310.   MDI1.ShowExample(1).Enabled = True
  311.   Command5.Enabled = True
  312.   MDI1.Command5.Caption = "Comments "
  313. End Sub
  314.  
  315. Private Sub Net1_AddLink()
  316.   Dim curItem&, Org&, Dst&, itemData&
  317.   Dim itemType%
  318.  
  319.   curItem = Net1.Item
  320.   Org = Net1.Org
  321.   Dst = Net1.Dst
  322.   Net1.Item = Dst
  323.   itemType = Net1.Type
  324.   itemData = Net1.Data
  325.  
  326.   Select Case itemType
  327.   Case 1
  328.     ' Delete link
  329.     Net1.Item = curItem
  330.     Net1.EditAction = 2
  331.  
  332.     ' Look for first owned node
  333.     ' Create a link towards this owned node
  334.     Net1.Dst = itemData  ' First owned node
  335.     Net1.Org = Org
  336.     Net1.DoSelChange = False
  337.     Net1.DoAddLink = False
  338.     Net1.EditAction = 1
  339.     Net1.DrawColor = RGB(255, 0, 0)
  340.     Net1.DrawStyle = 0
  341.     Command5.Enabled = True
  342.     Net1.DoSelChange = True
  343.     Net1.DoAddLink = True
  344.   Case Else
  345.     Net1.Item = curItem
  346.   End Select
  347. End Sub
  348.  
  349. Private Sub Net1_AddNode()
  350.   Net1.DrawStyle = 5 ' Invisible
  351.   Net1.Type = 0
  352.  
  353.   ' Force node size
  354.   Net1.Y2 = Net1.Y1 + 500
  355.   Net1.X2 = Net1.X1 + 500
  356. End Sub
  357.  
  358. Private Sub Net1_DblClick()
  359.   If Net1.Item <> 0 And Not Net1.IsLink And Net1.Type = 0 Then
  360.     Legend = Net1.Text
  361.     If Net1.Picture = Picture1(0).Picture Then
  362.       Picnum = 0
  363.     ElseIf Net1.Picture = Picture1(1).Picture Then
  364.       Picnum = 1
  365.     Else
  366.       Picnum = 2
  367.     End If
  368.     AlignMent = Net1.AlignMent
  369.     frmAlign.Show 1
  370.     If Ok Then
  371.       Net1.Text = Legend
  372.       Net1.Picture = Picture1(Picnum).Picture
  373.       Net1.AlignMent = AlignMent
  374.     End If
  375.   End If
  376. End Sub
  377.  
  378. Private Sub Net1_KeyDown(KeyCode As Integer, Shift As Integer)
  379.   Dim l&
  380.  
  381.   Select Case KeyCode
  382.   Case KEY_DELETE
  383.     Net1.EditAction = 2
  384.   Case KEY_LEFT
  385.     l = SendMessage(Net1.hWnd, WM_HSCROLL, SB_LINEUP, 0)
  386.   Case KEY_RIGHT
  387.     l = SendMessage(Net1.hWnd, WM_HSCROLL, SB_LINEDOWN, 0)
  388.   Case KEY_DOWN
  389.     l = SendMessage(Net1.hWnd, WM_VSCROLL, SB_LINEDOWN, 0)
  390.   Case KEY_UP
  391.     l = SendMessage(Net1.hWnd, WM_VSCROLL, SB_LINEUP, 0)
  392.   Case KEY_NEXT
  393.     l = SendMessage(Net1.hWnd, WM_VSCROLL, SB_PAGEDOWN, 0)
  394.   Case KEY_PRIOR
  395.     l = SendMessage(Net1.hWnd, WM_VSCROLL, SB_PAGEUP, 0)
  396.   End Select
  397. End Sub
  398.  
  399. Private Sub Net1_SelChange()
  400.   If Net1.Item <> 0 And Net1.IsLink And Net1.DrawColor = RGB(255, 0, 0) Then
  401.     Command5.Enabled = True
  402.   Else
  403.     Command5.Enabled = False
  404.   End If
  405. End Sub
  406.  
  407.